package com.nxn.core.web.tag;

import org.apache.commons.io.FilenameUtils;

/**
 * Some utilities for file related operations.
 * 
 * @author Michael Zhang
 */
public class FileUtilities {

	/**
	 * Tests whether the input name ends with JavaScript file extension or not.
	 * 
	 * @param name
	 *            The file name.
	 * 
	 * @return The boolean.
	 */
	public static boolean isJavaScript(String name) {
		return "js".equalsIgnoreCase(FilenameUtils.getExtension(name));
	}

	/**
	 * Tests whether the input name ends with StyleSheet file extension or not.
	 * 
	 * @param name
	 *            The file name.
	 * 
	 * @return The boolean.
	 */
	public static boolean isStyleSheet(String name) {
		return "css".equalsIgnoreCase(FilenameUtils.getExtension(name));
	}
}
